fixed bug in does_exist()