Fixed NPE in range