fixed outofrange exception