Some changes for better image handling.