Fix: Initialize $htmlAttributes in the proper place

Closes #417