Fixed error when used with headjs