More fixes, but not yet production ready