fixes for NPE and cache conflict

Says it cant be merged... I don't see the problem.  kick it back if it is a pain.