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