Fixed bug if val is null