Change check order as hasHandlers() is a synchronization hotspot