Compilation warning fixes and parse crash fix

(Sorry for the multiple fixes in one request)
This fixes a couple of build errors/warnings when building for AVR32 and for OSX using clang.

I am not 100% sure that I understood the custom handlers right, so my crash fix might be incorrect.