trim trailing spaces from keys