[FIX] Fixed null ptr exceptions.