fix the bug in a better way.