fix bug for task #23
stable version of task #23