Some security fixes from Aidil.