Fixed the condition for the bounds adjustment and removed diagnostics