Fixed exit codes. It was swallowing them and not returning them correctly

Non-zero error codes where not returned, returning zero instead