Commited #449 after modification for client mode.