2003 Bmw 525i Sunroom sticks

When you push the button to prop the back end of the sunroof up it will go through the cycle but not stay open and try to open completely and retract back. When opening completely it will retract and the metal plate comes with it then it will retract back but won't close completely and you have to hit the button a little bit at a time in order to close it.