fixed more bugs about the evil NPE