Merge pull request #1 from cubejs/master

rebase
+ bugfix & unit test
Merge pull request #2 from inexplicable/master

bugfixes