Fix function to pass test