bugs fixed for self-hosting