fix darwin bugs