Pet Attack Forces Ranged Skeletons to reposition theirselves, which is a huge dps loss

After pet command, They reposition themselves even their “attack line sight” is not blocked and enemy is in range. This repositioning makes me reluctant to use the command