changed permission checks, offset and limit