added additional check for null results