fixed bugs & add more functions in basic math lib