check, to which pins of arduino you have connected your transmitter and reciever pins. if you are using the pin number 1 and 2 for the transmission and receiving purposes, then ensure that the connections to those pins are removed while you are dumping your code into the arduino through usb. As these pins are by default used by USB while USB cable is connected, the results may not come as expected. Hope this tip may help you. Because i didnt find what was your issue correctly, i could only give this expected suggestion.