minor bugfix in error handling