explicitly check type when reading value