Fix a gui thread error and add a plugin function.