FreeImage: fix bug & cleanup