add more exception handling.