fixed path problem
some optimizations