bugfix from Ilya Sytchev