removed global 'currententity' to avoid access violation error in future