Fixed some type issues, Fixed #47