ugly fixes but works for now