fix NPE on spatial layer