fixed a bug in 'square' demo