fix nullpointerexception
improve char parser