Changed from .asBool() to cast to bool since the previous version gives problems.