work on BSD and Windows