bug fix: exiting code right