Some gres bug fixes for new logic