added BP patch and lots of minor fixes