fixed bug in flat BG integral