Fixing a bug when trying to use the plugin without a opened layer