fixed crash when imagemagick used by concurrent requests.