SDL fixes and improvements