Fixed the missing direction bug