fix some layer ordering bugs