Fix code or Pull Request #109

*Fix type
*Fix tests
*Fix coding styles