some bug fixes
fixed some bugs