Fix conditions to properly redirect to the top page.

Fix if statement which is always false because of judging by string.