Yes, its 16f877A, my mistake.
I tried connecting the MCLR pin to the +5v but it didn't help.
It also didn't help using 2x 7805.
Its very strange because I have another circuit just exact to this one but using a 887 on a demo board.
BTW, if I use the programmer voltage output (just + and - ) and connect them to the circuit its also working ok.