generic mode nullpointer fix