fixed compatibility for PowerShell v3+