Fix NPE on Mac