fix bugs in storage implementation