Fixed the constraints. Does not crash anymore