Fix NPE with hats