Fix layout javascript error