Tests and boolean expressions bug fixing