fixed bugs which caused php-warning 'illegal offset type'