fixing bug #4340 by simplifying code and using correct methods
fixing bug #3207