fix segfault on groovy, not tested on fuerte see #4