fix for invalid operand exception