a few bugs fixed