Fix performance problem

Media files were loaded from server while each request but should be loaded only once
added additional verification for that