Fixed the bug properly