added check for handler before attempting to unbind [fixed #7]