[SECURITY] Fixing potential XSS issues

Will resolve #926 once merged.
Merge pull request #930 from TheSerapher/issue-926

[SECURITY] Fixing potential XSS issues