Feature #1791: Avoid deadlock
Check if image has to be moved to error before getting it
Merge branch 'master' into feature-1664