native engine code cleanup