Fixed NPE-like error