Fixed stamp encoding and added js stamp checking