Adding testcase which shows problem with local reference counting
minor improvement