Slightly better exception handling