added function for loading image data
small bugfixes