I think I fixed an error in this function