fixxed errorhandling