bug fix and add a quick test