Lots of fixes for deployment