Fixing boolean to work as expected