bug fixes and exits