Fixed check for optional element