fixing offset error and other typos