make std linear eq. correct, and use clamp functions