less computation for weird config and bug fix

Change-Id: I2afebf88931e1c1b7caaf9ecb7e7e739f6775909