Fixed bug in check_names
Fixed bug in check_names