fixed some bugs and made the plugin compatible with Kirby 2