killcount fix and npe fixes