Fixed faulty lookahead in manifest parser and improved error handling.