Replaced C++11 nullptr with NULL because flip (gcc 4.4.7) can't handle it