added sdl, several bug and typo fixes