Added NULL checks on client message listeners (to prevent crashes for invalid or uninitialized clients)