Bug regarding not checking the return code fixed.