Fixed bug for submitting code to thread, and also made possible to force submission