this works but gives errors