fix optimazation issues