added errorhandling