If gatway is dynamic the type cannot be determined, trim the code trying to do something impossible. While here optimize a bit