manual merge with vuaru's Derelict3 version