Fix scanning bug, error reporting and EOF bug