reverted back to old code, as i caused a bug somewhere