Some general fixes/improvements