Add handler for errors