Some bug fixes regarding run_command