Moving the registry_rebuild() function before the return statement.