Fixed index and null pointer errors on tokenizer()