fixed freezing bug