Fixed missing parenthesis and reduced number of cursor operation