fixed missing first char and 0 empty value bugs and added tests

Looks like these bugs came from updates to the JS that missed a couple of changes on the backend.