Fixed the existing bugs