fixing return chain for flashing, fixing exit codes, fixes #88