fix errors with setAttribute