Enabled completion and fixed some bugs