updated to work with go1.2

Looks like this repo hasn't been touched for a while... but I'm using your code for a little thing I'm working on. I had to make some changes to get it to compile with go1.2, but not many. I figured I might as well try to get them merged in.