fix layer boundary discrepancies