loop until correct inputs are given by user.