Second attempt at fixing, debugging