update buildhist and other functions