fixed several sq bugs