more error handling - still not perfect...