added check for placing units
fixed merge