added protection around imageMagick