fixed a bug and a corner case caught by unit tests
not using bullet to make these tests more reliable