fixes and standalone functions