Fix bug in placing tags