improved theme functions and fixed #109