fixes #371 and storage bug.