Improve wrapper script to avoid unnecessary warnings; thanks to Martin