Never ever use \ManiaLib\Gui\Elements\Frame() to create frames...Fixed finally the 'invalid document' error!