rough error location reporting + minor fix