Removed NULL, corrected cast to comply c++.