Wrong casting which worked on Linux, but not on Windows and OS X.