fix bw stuff, add some tests