Further attempt to fix setAttribute error