further fix syntax errors in both functions.