some optimisations for Windows