fixed IO, added exit codes

IO redirection is still buggy