make chooseFile work when canceled
partial changes to allow generating from images