Fix TypeError values is null

Fix issues #1