[SECURITY] Fixing potential XSS issues

Will resolve #926 once merged.