extending the test, fixed a few more subtle bugs found in testing