fixed tricky bug