checking collision/adjusting position