Better tests and fixed bug with logical operators