Exposed some classes to lua framework, fixed some bugs.