add error handling
merged