MANY bug fixes in assignmentlibrary add function (don't use yet)