using with to write encrypted storage
fix unused imports