fix first and last pages