Fix a bunch of bugs ive introduced recently that broke threaded decoding.