fixed bug in direction