Fixed broad phase for negative z values. Fixed memory leak/warnings.