Implement fixes suggested by Slava K.