Threading issue when adding metrics without sending

Fixes issue #33. Not completely comfortable with the implementation using the lock, so feel free to offer suggestions.