a proper way how to correcly read a resource file