various bug fixes
bug fix