bn: various fixes