fixed a few errors that occured when using this plugin