fixed the direction checks