Fixed various issues wrt query execution on the server side. Also fixed
issues wrt execution of shell.