Fix storage logic. Close #390