fixed few bugs found from pr