Fix return code inconsistency.

Use -1 to indicate error instead of using 0