Some security improvements