some cleanup and fixing breaking bug introduced by merge