added edit-page controller and fixed script running errors