bug fixing, more test coverage