fixed amazing bug that took me almost a day