bug fix and add tests for getcurrent