replace deprecated error handling

resolves #50