Fix for issue #103

Fixed incorrect arguments passing. Also reviewed some other cases, now seems to be correct.