perfomance optimization bugfix