Fixed updatehome and initializehome functions