Fixed script for new json format