Fix javascript removal not working correctly in new layout.