enhancement and bug fix

Hi Fisher,

Thanks you for this excellent plugin, I have used this plugin in one of my project 
https://github.com/chunchill/ITMS/tree/master/source/ITMS.Web

And I also found some bugs and fixed them, meanwhile, i have do some enhancement for this plugin.
please have a look.

Regards, Jasper