taking atemp into account using lsq