#TODO: fix 'x and y must have the same dimension' error