Fix NPE in getId()