Fix two bugs

1. Log tag error if the tag is create on a tag instead of commit
2. Tempfile needs to shift wo binmode before write content to a raw object.