support SDL1 and a few bugfix SDL2