bugfix. multiple images can be read now. add checking input arguments