Fix a bug by moving lb related code within #if