fix TypeError exception - Boolean value of this clause is not defined