more length control and fixed stupid bug for profile