some changes and improvements on C extensions.