Rectified some bugs