Fixed #3

Based con this comment on StackOverflow http://stackoverflow.com/a/16936208/1072990