for expand bug and precomputing