i don't know whether this is a problem:
When i practise difficult pieces, i tend to restart the piece all over again when i make a mistake. I think it becomes a problem because in the end i know the beginning of the piece really well but stumble for the rest of the piece:\
Weiwei, that is a problem because, just as you say, you learn the beginning but you don't really learn the rest.
Some solutions are:
1.) When you begin to work on a new piece, mark the biggest problem spots. Pick one to begin your practice session and work that section carefully. Then pick another and do the same.
2.) Find the sections of the piece and work a section at a time, but start with the end of the piece (I call it "backward practice" -- not that you practice in retrograde, but that you work by section from end to beginning.) Of course some sections may have a sub-section that needs special attention. In that case, work the difficult part(s) of that section first and then put them into context.
3.) An extreme form of the above is to work from end towards the begininning by measure (play last measure, then play the last two, etc.) or even beat. This is sometimes effective in pieces that have constant motion.
Note that where you fall apart may not be the actual problem, but a symptom of an earlier problem -- poor fingering choice that works up to this point, poor hand position, mis-reading, etc. Working from end towards the beginning helps to determine fingering and other factors according to how you need to end section in regards to fingering so that you are prepared for the next section.
4.) Know what sections are repeated (exactly or similarly -- such as the second theme group in a sonata which is first played in some non-tonic key and then recapitualed in tonic). This will help you to be consistent with your fingering when possible and to understand any differences required.
Hope this helps and welcome to Piano Society,