add states array and fix some php notices