fix flashing and animation smoothness