Fixed a navigation bug and a memory leak