add error handling of require statements