Check message type before handling it (cc @DevinWatson)