fixed bug in dynamodb write