Fixing casting to 'long', reducing size of memory frames