various bug fixes
various bug fixes