fix bug in g command
misc updates