Fix entity problem with security