String functions and bug fixes