additional checks to avoid crash