sftp rename not over writing

Hi,
I have an sftp script :
put file1.txt file1.txt.cp
rename file1.txt.cp myfile.txt

But the problem is, if the file myfile.txt exists at the remote location, the sftp fails to overwrite. How do I make it over writing.

I am using ssh version
OpenSSH_4.1, OpenSSL 0.9.7e 25 Oct 2004
HP-UX Secure Shell-A.04.00.000, HP-UX Secure Shell version

Please help me

Thanks in advance
Shihab

I searched around on google and found this. From that doc,

Looks like that is how it is supposed to behave. Try removing the existing file before you call rename.

blowtorch is correct, this is expected behavior(it's by design), overcome this by removing the the existing file.