Various bug fixes & autocomplete improvements