Fix some parsing and query issues.