Does the white wire run with the black one in the same cable or conduit from the receptacle to the switch to the fan? If not, this could be the cause of your trouble.