Cleanup, fix type mismatch int/long