Fixed bug in image creating