error handling added to __init__