Here is a series of small fixes to the MAD code that I applied on my branch. They fix the build on non-i386 archs and clean up a few other minor things. - R.