fix trailing comma check corner case