fixed several bugs

Adding power and indices is working correctly now