Some fixes. Debug is needed.