Various fixes for master branch