Fix functio not returning value