Fixed bug then memory allocated by using int instead of size_t