Smallfixes

Several fixes to groovysh, for problems on Linux and things I did not like. I have next to zero experience with Groovy, so obviously merge with caution. I can provide more explanation and unit tests if the code is not self-explaining.