corrected SVQ algorithm