More fixes for bugs found using xsthammer