texture changes and bugfix in functions.h