fix issues with .. and . in paths

This fixes an issue when regexp fails in such string: os.listdir('/home')
There was 2 matches: '.listdir(' and '/home'
/ on linux should return root dir