(Hopefully) fixed a bug with layer ordering