support for 'system' command and some minor fixes