Fixed a bug with JOIN order when using field mapping.