another attempt at catching errors