Errors, security, minor fixes