minor optimizations (php, js)