fix constrains bugs