Merge "Fix potential NPE and also add more log." into oc-dev