exception catching, fix boilerplates