Added costum error handling