Merge "Fix a bug when calling onError(int)" into pi-dev