Fixed check on return value before printing.