fix fs.readFileSync() with 2 args

Right now this doesn't work:
```
var txt = fs.readFileSync(__dirname + '/robot.html', { encoding: 'hex' });
```

With this PR, it now works. Test added, too.

I think your logic on the function test had two bugs and they canceled each other out. (found with the help of @dcposch)