fixed few bugs