bug fix by Zelenov