fixed problem with resource saving