I tried to reproduce the scenario. For me in User Tool it worked fine. But in Mid Tier, in first attempt, it returned me some integer value " 3 ".
Then I flush the mid tier cache and restarted the tomcat services and tried once again.
This time it worked as expected.
I suggest you to try restarting tomcat services and flush mid tier cache once.