Fixed compilation errors, null pointer to fix