Fixing some bugs and adding a preload

Change-Id: Ida8d4c0516d7d032460bb01397077894c000443f