[SPARK-2710] code style and bug fix after code review rev. PR #1612