fix compile warnings

fix warning of the following.
* using undefined constant
* using deprecated method
* extra argument of the method
http://osc.matsukei.net/issues/399 fixes #399