added toBoolean cast function