fixing a bug caught by Peter - see test for details. Closes https://github.com/davidedc/livecodelab/issues/239