UN in talks to rescue Sudan deal