fixing load function