check for undefined for eventhendlers