corrected error handling in __init__