fixed logic bug that throws unneeded exception