Fixed array count bug in image retrival.