Fixed freezing problem