reproducing NPE exception with checkCallingPermission
Fixed checkCallingPermission() problem