Fixed a bug in TabBarController delegate function.