integrate with bwd.c from rosewright for 2.14