Add unit tests for recently added features, fix issues with a few metamethods