Added tests and fixes for some corner cases