CAS-1399: Fixed NPE