Fixed errors in variable coding