Fixed the error handling. TODO: How to handle change in parsing scheme?