Added a check on the system() call that has been failing