added check_string, removed some bugs