fixed it, ugly but functional