fixes position calculations