Image handling bug fix