Edit: Hmm, just googled this and there seems to be an issue with 'min/max' in IDE 1.6.5. indeed. Not even sure if math.h is actually needed for 'min/max' to work.
Anyway, seems you can try adding the 'max' definition directly to the sketch like this:
#define max(a,b) ((a)>(b)?(a):(b))