Fixes a seg fault in brain engine