Fixed screen tearing

thank you to the stack overflow community :)