[Core] Fix some bugs, better structure for python libraries (now in app/pythonlib)