Few bug fixes, and some more utils