fixingg isValid loop...