fixed some nullpoiner exceptions