Fix broken functionality

TODO:
* Add more test