replace exit with return