Thanks for your help Erazor but I don't think that is the cause of the problem: if I run the script as root I get the same error, but if I run the commands inside (pnatd etc.) as plain user manually they work fine. So I guess there is something wrong with the error detection code that prints the message.