Fixed a bug causing the wrong list of layers to sometimes be displayed on the add layer page