working on image handling, cant write image data to path