performance improvement: prevent exceptions.