Added some tests and fixed a boolean related issue