proper handling of containers and other fixes