moved mkdir for images directory last