changed environment and fixed bugs in search process