Fixes for export AMD option

This is from farnsworth's fork,