Misc fixes and small improvments