minor modification to make it work