general fixes to make it work