Please check whether you have byzantiumBlock: 0 in your genesis file. If not, please add it and regenerate your private chain. See my genesis file below.
{                                                                                                                              
   "config": {
      "chainId": 1994,
      "homesteadBlock": 0,
      "eip155Block": 0,
      "eip158Block": 0,
      "byzantiumBlock": 0
   },  
   "difficulty": "400",
   "gasLimit": "2000000",
   "alloc": {
   }   
}
After doing this, your code should work.