Fix some error that occurs by the improper usage of vector and remove useless code