Finally, a proper fix for #175: support -thread and -vmthread flags