Better but not perfect fix to the previous