fixes to bilayer building