fixing layout and runtime errors.