fixed some typos and bug, redone mapped writer to fix bugs