Fixed the bugs slightly