Fix handling of multiple commands