fixed major bug with layer ordering