upd with fix for bugs