Fixed bugs with drawing images