added patches from waiting moai pull requests