this function should return an error too.