Added more negative tests and fixed bugs