added isValid & prevent_direct_access