modified preload function