Many fixes, thanks @manishtomar