More improvements for the last fix. Thanks to Oleg