Made compatible with OS X (removed usage of expr)