Fixed bugs in query and FakeDynamo