Powershell Function Not Returning Correct Value