Fixed compilation errors
Fixed naming, added null check for mapped pointers