various fixes still not working but this is better than what I stashed before.