return -1 on error, not 1