Repaired layout's js code