fixed typeerror/valueerror mixup