Testsuite fixes

Fix some issues found in the automated testsuite. It would also be great to have a way to set the desired interpreter since I'm running the tests by replacing /bin/sh with /bin/bash or /bin/zsh every time, but I've not found any sensible way to do it yet.