added exit status check in file