cam fix and null ptr fix