Added logic to detect bagpath and name in 'bag' command. Fixes #9