Several fixes from todo list