fix on John's code