Fix bug with undefineds in result