no endless loop fix and fix Freelayout