Fix bug where tab key does not work properly