fixed minor bug, image turns out blue when written for some reason