Fix bug in moveInDirection & add test