Patches

Various patches to support real use cases. Already reviewed.