fix few bugs