max instead min issue