corrected bugs in enforcing BCs globally