Fixing bug which made the plugin not work in certain conditions.