reverted some changes to avoid crash in Windows