maybe a fix to the if exists statement