fixed utf-8 encoding problem
improvements to security