Vulnerabilities corrections

Making static field final to protect them from malicious changes
Minor error correction
Minor error correction
Minor error correction
Error handling corrections
Error corrections