Add guard for invalid binary operations