Also, just to mention again, screen,flip magically solves the problem, which made me think that it was a incorrect screen update issue. But the code seems pretty simple and couldnt really find any screen update bug.