fixes #420
work on #408
some bug fixes in plugin (not finished)