buggy version, but could run on some simple case