clean up -g handling