catch tests exitcode (this needs to be greately improved)