fixed bug in instantiate modal where class path list got longer with every call