pixel loop is working, but SFML crashes