Performance improvements (bugfix)