fixing bug with flatted keys