Improved deriv. comp. and fixed some bugs.