fixed bug in unit movement calculation