eventually got rid of the double rebuild issue. please have a look.