fixed NPE, which shouldn't be throwed.