Ot test4

Added more negative tests
Fixed a number of bugs revealed by those tests