Fixes the nil dereference when imagemagick is used