Fix some ClassCastExceptions from MVEL scripts

Fix some class-cast issues while interacting with MVEL. Related to discussion at https://groups.google.com/forum/?fromgroups#!topic/elasticsearch/prHbqX20PtM