improved error handeling and error output