Improved error messaging. Fixed bug in getMethods failing when no asJSON parameter was provided.