correct NULL issue in main.cpp: