Synced with php-client