Merge all fixes and hacks into one branch