Ported to SFML2.0, fixed bugs related to threads