Octave compatability improvements

While using this project with Octave 3.6 instead of MATLAB, I stumbled upon some compatability issues that I resolved. These changes were not tested with newer versions of Octave but I don't see why they shouldn't work there, too.