add bug fixes from kanabo