fixed subscriber bug in main library as per stackoverflow question http://stackoverflow.com/questions/22442890/