Fixed NPE problem