fixed bug in one of mystery functions