some bug fixes

some bug fixes