Fixed retrieve function