z-index logic fix