fixed 3 bugs, current problem is that qtype_index isn't calculated correctly