Fixed bug on memory count
Check for negative memory usage
Update build