Made preMount function more robust