fixed the addvalue function waiting for a proper validation