Add forgotten include (error on MinGW). Fix a wrong typecast.
Merge pull request #869 from jimis/master

Add forgotten include (error on MinGW). Fix a wrong typecast.