Fixed few bugs