collect errors and return 0 for no error