Fix bug in exists